<template>
<div>
	<div class="g_top_box">
		<div class="g_right_box">
			
		</div> 
		<div class="g_left_box"><h4>日志列表</h4></div>
	</div>
	
	<div class="g_list_box">
		<div class="g_filter_box">
			<Form ref="formDynamic" :label-width="50" style="width: 100%">
				<Input v-model="filter.name" placeholder="操作人员" style="width:130px;"></Input>
				<Input v-model="filter.module" placeholder="模块" style="width:130px;"></Input>
				<DatePicker type="datetimerange" format="yyyy-MM-dd HH:mm" placeholder="选择日期时间" style="width: 250px" @on-change="date_change"></DatePicker>
				
				<Button type="primary" @click="qurey">搜索</Button>
			</Form>
		</div>
		<div class="g_list_box">
			<Table :columns="Columns" :data="list" style="width: 100%;"></Table>
		</div>
		<div class="g_page_box">
			<Page :total="count" @on-change="goto_page"></Page>
		</div>
	</div> 
</div>
</template>

<script>
export default {
    name: 'list',
    data () {
		let vm = this;
        return {
            Columns: [
				{
					title: 'ID',
					key: 'id',
					align: 'center',
                    width: 120
                },
				
				{
                    title: '操作人员',
					key: 'admin_name',
					width: 120,
                },
				{
                    title: '日期',
                    key: 'addtime',
					width: 180,
                },
				{
                    title: '模块',
                    key: 'module',
					width: 180,
                },
				{
                    title: '内容',
					key: 'msg'
					
                },
            ],
            list: [],
			count:0,
			page:1,
			filter:{
				name:'',
				module:'',
				start_time:'',
				end_time:''
			}
        };
    },
	created(){
		
		this.load_data();
	},
    computed: {
       
    },
	methods:{
		load_data(){
			var self = this;
			var postdata = {
				f:this.filter,
				page:this.page
			};
			Whttp.load('System/Logs/get_list',postdata,function(result){
				self.list = result.list;
				self.count = parseInt(result.count);
			});
		},
		
		goto_page(page){
			this.page = page;
			this.load_data();
		},
		qurey(){
			this.page = 1;
			this.load_data();
		},
		date_change(date){
			
			this.filter.start_time = date[0];
			this.filter.end_time = date[1];
			
		}
	}
};
</script>